package com.zby.model.pojo;

import com.zby.model.enums.StatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.autotable.annotation.AutoColumn;
import org.dromara.autotable.annotation.AutoTable;
import org.dromara.autotable.annotation.Index;
import org.dromara.autotable.annotation.TableIndex;
import org.dromara.autotable.annotation.mysql.MysqlTypeConstant;

/**
 * @author wuyanzhu
 * @TableName article
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AutoTable(comment = "文章")
@TableIndex(fields = {"status", "deleted"})
@Schema(description = "文章")
public class Article extends BasePojo {
    @Schema(description = "文章标题")
    @AutoColumn(length = 100, notNull = true, comment = "文章标题")
    private String title;

    @Schema(description = "文章内容")
    @AutoColumn(type = MysqlTypeConstant.LONGTEXT, notNull = true, comment = "文章内容")
    private String content;

    @Schema(description = "文章摘要")
    @AutoColumn(length = 255, comment = "文章摘要")
    private String summary;

    @Schema(description = "文章封面")
    @AutoColumn(length = 255, comment = "文章封面")
    private String coverImage;

    @Schema(description = "文章作者id")
    @Index
    @AutoColumn(notNull = true, comment = "文章作者id")
    private Integer userId;

    @Schema(description = "文章分类id")
    @Index
    @AutoColumn(notNull = true, comment = "文章分类id")
    private Integer categoryId;

    @Schema(description = "文章状态")
    @AutoColumn(notNull = true, comment = "文章状态")
    private StatusEnum status;

    @Schema(description = "文章点赞数")
    @AutoColumn(defaultValue = "0", notNull = true, comment = "文章点赞数")
    private Integer viewCount;
    @Schema(description = "文章观看数")
    @AutoColumn(defaultValue = "0", notNull = true, comment = "文章关看数")
    private Integer likeCount;
}
